import 'package:im_app/im/socket/dto/base/Resp.dart';

import '../../service/Path.dart';
import '../dto/business/Login.dart';
import 'RpcService.dart';

class RpcLoginService extends RpcService {

  // 密码登录
  Future<LoginResp> login(LoginReq loginReq, [int? timeOutSecond = 60]) async {
    return this.sendDataAndOk(ImPath.login, loginReq, LoginResp.fromJson, timeOutSecond);
  }

  // token 登录
  Future<LoginResp> loginByToken(LoginTokenReq loginTokenReq, [int? timeOutSecond = 60]) async {
    return this.sendDataAndOk(ImPath.loginByToken, loginTokenReq, LoginResp.fromJson, timeOutSecond);
  }

  // 滑屏 登录
  Future<LoginResp> loginBySlide(LoginReq loginReq, [int? timeOutSecond = 60]) async {
    return this.sendDataAndOk(ImPath.login1, loginReq, LoginResp.fromJson, timeOutSecond);
  }

  // 断线重连
  Future<LoginResp> reconnection(ReConnection reConnection, [int? timeOutSecond = 60]) async {
    return this.sendDataAndOk(ImPath.reconnection, reConnection, LoginResp.fromJson, timeOutSecond);
  }

  // 退出
  Future<LoginResp> logout(ExitReq loginReq, [int? timeOutSecond = 60]) async {
    return this.sendDataAndOk(ImPath.logout, loginReq, LoginResp.fromJson, timeOutSecond);
  }

  // 滑屏设置密码或重置密码
  Future<OkResp> resetSlidePassword(ResetSlidePasswordReq resetSlidePasswordReq, [int? timeOutSecond = 60]) async {
    return this.sendDataAndOk(ImPath.resetSlidePassword, resetSlidePasswordReq, OkResp.fromJson, timeOutSecond);
  }
}